import Router from 'koa-router';
import proxyService from '../../../common/proxyService';
import {
  getBargainActiveOverview, // 砍价-活动数据概览
  getBargainActiveLine, // 砍价-活动数据统计数据
  getBargainRankGoods, // 砍价-获取排行榜商品列表
  getBargainRankHelpList, // 砍价-获取排行榜助力列表
} from '../../../api';

const router = new Router();

// 砍价-活动数据概览
router.post('/getBargainActiveOverview', async ctx => {
  const response = await proxyService.postProxy(ctx, getBargainActiveOverview);
  // const response = {
  //   code: 1,
  //   data: {"totalBrowseNum":0,"todayBrowseNum":0,"yesterdayBrowseNum":null,"totalVisitNum":0,"todayVisitNum":0,"yesterdayVisitNum":null,"todayJoinNum":0,"totalJoinNum":0,"yesterdayJoinNum":null,"todayhelpBargainNum":0,"totalhelpBargainNum":0,"yesterdayhelpBargainNum":null,"todayMissionNum":0,"totalMissionNum":0,"yesterdayMissionNum":null,"todayOrderNum":0,"totalOrderNum":0,"yesterdayOrderNum":null,"todayPriceNum":0,"yesterdayPriceNum":null,"totalPriceNum":0,"cancelNum":0,"unCancelNum":0}
  // }
  return (ctx.body = response);
});

// 砍价-活动数据统计数据
router.post('/getBargainActiveLine', async ctx => {
  const response = await proxyService.postProxy(ctx, getBargainActiveLine);
  return (ctx.body = response);
});

// 砍价-获取排行榜商品列表
router.get('/getBargainRankGoods', async ctx => {
  const response = await proxyService.postProxy(ctx, getBargainRankGoods);
  return (ctx.body = response);
});

// 砍价-获取排行榜助力列表
router.get('/getBargainRankHelpList', async ctx => {
  const response = await proxyService.postProxy(ctx, getBargainRankHelpList);
  return (ctx.body = response);
});

export default router;
